package com.example.java_chatroom.service;

import com.example.java_chatroom.mapper.MessageMapper;
import com.example.java_chatroom.model.Message;
import com.example.java_chatroom.model.SessionPersonage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageService {
    @Autowired
    private MessageMapper messageMapper;

    public String getListMessageBySessionId(Integer sessionId) {
        return messageMapper.getListMessageBySessionId(sessionId);
    }

    public List<Message> getMessagesBySessionId(Integer sessionId) {
        return messageMapper.getMessagesBySessionId(sessionId);
    }

    public Integer insertSession(SessionPersonage sessionPersonage) {
        return messageMapper.insertSession(sessionPersonage);
    }

    public void deleteMessage(Integer sessionId) {
        messageMapper.deleteMessage(sessionId);
    }

    public void deleteMessageBysessionId(Integer sessionId) {
        messageMapper.deleteMessageBysessionId(sessionId);
    }

    public void deleteMessageUser(Integer sessionId, Integer userId) {
        messageMapper.deleteMessageUser(sessionId, userId);
    }
}
